import request from '@/request/ajax.config'

// 获取规则链信息
export function getRuleChain(ruleChainId) {
  return {
    "code": 200,
    "msg": "查询成功",
    "data": {
      "ruleChainId": "b89cf6ab-da1d-6b5c-668e-0ac3331eaed1",
      "firstNodeIndex": 0,
      "nodes": [
        {
          "additionalInfo": {
            "x": 90,
            "y": 150,
            "icon": "startNode",
            "clazz": "StartNode",
            "visible": true,
            "component": "ExternalNodeStartNode",
            "inEnabled": false,
            "outEnabled": true,
            "editEnabled": false,
            "relationTypes": [],
            "removeEnabled": false,
            "defaultConfiguration": null
          },
          "nodeId": "5970b96d-43a2-bbd6-f614-003be6d74bdb",
          "frontId": "rule-node-0",
          "nodeName": "开始",
          "nodeDescription": "设置初始节点相关配置",
          "nodeType": "START_NODE",
          "configuration": null,
          "component": "ExternalNodeStartNode"
        },
        {
          "additionalInfo": {
            "x": 300,
            "y": 45,
            "icon": "serviceLib",
            "clazz": "ServiceTemplateNode",
            "visible": true,
            "component": "ServiceLibServiceNode",
            "inEnabled": true,
            "outEnabled": true,
            "editEnabled": true,
            "relationTypes": [
              "Success",
              "Failure"
            ],
            "removeEnabled": true,
            "defaultConfiguration": null
          },
          "nodeId": "b4c54704-8f93-8ab3-e1d2-2c9af41e65c2",
          "frontId": "rule-node-3",
          "nodeName": "空白服务",
          "nodeDescription": "",
          "nodeType": "SERVICE_NODE",
          "configuration": {
            "executionOrder": null,
            "serviceSequence": null,
            "interruptionStrategyType": "skip"
          },
          "component": "ServiceLibServiceNode"
        },
        {
          "additionalInfo": {
            "x": 570,
            "y": 75,
            "icon": "sceneLib",
            "clazz": "SceneTemplateNode",
            "visible": true,
            "component": "SceneLibSceneNode",
            "inEnabled": true,
            "outEnabled": true,
            "editEnabled": true,
            "relationTypes": [
              "True",
              "False"
            ],
            "removeEnabled": true,
            "defaultConfiguration": null
          },
          "nodeId": "cbf911ef-7d14-26cc-e4a1-5b71aa653821",
          "frontId": "rule-node-2",
          "nodeName": "空白场景",
          "nodeDescription": "123",
          "nodeType": "SCENE_NODE",
          "configuration": {
            "subScenes": [
              {
                "signals": [
                  {
                    "value": 10,
                    "offset": "",
                    "operator": "==",
                    "signalId": "0_1017",
                    "openParam": {
                      "isOpen": false
                    },
                    "signalKey": "Notifier_EnBlowerLevel",
                    "resolution": "",
                    "serviceBid": "0x2002",
                    "signalName": "获得鼓风机风量/鼓风机风量反馈",
                    "metaModelId": "0_1017",
                    "signalGroup": "vehicleSignal",
                    "interfaceBid": "0x9001",
                    "optionalFlag": 0
                  }
                ],
                "signalLogic": "and"
              }
            ],
            "subSceneLogic": "and",
            "continuousJudgment": {
              "loopJudgment": false,
              "isContinuousJudge": false
            }
          },
          "component": "SceneLibSceneNode"
        },
        {
          "additionalInfo": {
            "x": 220,
            "y": 150,
            "icon": "frontConditionNode",
            "clazz": "PreconditionNode",
            "visible": true,
            "component": "SceneLibFrontConditionNode",
            "inEnabled": true,
            "outEnabled": true,
            "editEnabled": true,
            "relationTypes": [
              "True"
            ],
            "removeEnabled": false,
            "defaultConfiguration": null
          },
          "nodeId": "dcf6c86d-b128-dda8-61f4-5d2fbad4d753",
          "frontId": "rule-node-1",
          "nodeName": "前置条件",
          "nodeDescription": "产品执行的前置条件",
          "nodeType": "SCENE_NODE",
          "configuration": {
            "subScenes": [],
            "publishEvent": "ProductReadytoStart",
            "subSceneLogic": "and",
            "setPreconditions": false,
            "continuousJudgment": {
              "duration": 0,
              "keepTimes": 0,
              "keepStrategy": "part",
              "loopJudgment": true,
              "isContinuousJudge": false
            }
          },
          "component": "SceneLibFrontConditionNode"
        }
      ],
      "connections": [
        {
          "sourceNodeIndex": 0,
          "sourceNodeType": "START_NODE",
          "targetNodeIndex": 3,
          "targetNodeType": "SCENE_NODE",
          "connectType": "none"
        }
      ],
      "productDef": {
        "productId": "8fca413b-8b93-5289-1b35-44740094ec48",
        "productName": "test",
        "versionId": "78e9d524-1f1b-ab82-a82e-ce9047828eb4",
        "versionName": "1.0",
        "productType": "1",
        "versionDescription": "这是一段版本描述",
        "versionStatus": "0",
        "validityType": "permanent",
        "validityPeriod": {
          "endTime": "2100-01-01",
          "startTime": "2024-05-09"
        },
        "oemList": null,
        "serviceExecuteDesc": "这是一段服务执行描述",
        "triggerDesc": "这是一段触发方式描述",
        "voiceCommandList": null,
        "executeMode": null,
        "validateResult": null,
        "manualExit": null,
        "configuration": null,
        "optionalSignals": [],
        "ccuIdcVersionList": []
      },
      "extendData": {
        "editMode": "easy",
        "phaseNodeIndex": null,
        "serviceRecover": 0
      }
    }
  }
}
// 保存规则链信息
export function saveRuleChainInfo(param) {
  return new Promise((resolve, reject) => {
    function save(data) {
      return request({
        url: '/design/business/ruleChain/metadata',
        method: 'post',
        data
      }).then(res => {
        if (res) {
          const str = JSON.stringify(res)
          const send = JSON.stringify(data)
          if ((!send.includes('�')) && str.includes('�')) { // 如果返回有乱码的话可以重新保存
            saveCounts = saveCounts + 1
            if (saveCounts < 3) { // 最多保存次数。1就是只保存一次即使有乱码也不重新保存。3的话就是最多尝试调接口保存3次，以此类推。
              save(data)
            } else {
              resolve(res) // 超出尝试次数后则忽略乱码问题
            }
          } else {
            resolve(res)
          }
        }
      })
    }
    // 参数小于号转义
    const paramstr = JSON.stringify(param)
    const newParam = JSON.parse(paramstr.replace(/</g, '&lt;'))
    let saveCounts = 0
    // save(newParam)
  })
}

export function getRuleNodeComponents(params) {
  return {
    "code": 200,
    "msg": "查询成功",
    "data": [
      {
        "name": "场景",
        "icon": "sceneLib",
        "type": "SCENE_NODE",
        "nodeGroup": [
          {
            "name": "",
            "nodeList": [
              {
                "type": "SCENE_NODE",
                "name": "自动触发",
                "clazz": "AutoTriggerNode",
                "component": "SceneLibAutoTouchNode",
                "icon": "autoTouchNode",
                "description": "场景判断触发",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True"
                  ],
                  "defaultConfiguration": {
                    "subSceneLogic": null,
                    "subScenes": null,
                    "continuousJudgment": null,
                    "publishEvent": "ProductStart",
                    "loopJudgment": true
                  }
                }
              },
              {
                "type": "SCENE_NODE",
                "name": "主动触发",
                "clazz": "SceneLibManualTouchNode",
                "component": "SceneLibManualTouchNode",
                "icon": "manualTouchNode",
                "description": "用户主动触发",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True"
                  ],
                  "defaultConfiguration": {
                    "activeTrigger": "open",
                    "triggerMode": [
                      "click"
                    ],
                    "publishEvent": "ProductStart"
                  }
                }
              },
              {
                "type": "SCENE_NODE",
                "name": "自动退出",
                "clazz": "AutoExitNode",
                "component": "SceneLibAutoExitNode",
                "icon": "autoExitNode",
                "description": "场景判断退出",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True"
                  ],
                  "defaultConfiguration": {
                    "subSceneLogic": null,
                    "subScenes": null,
                    "continuousJudgment": null,
                    "publishEvent": "ProductStoping",
                    "loopJudgment": true
                  }
                }
              },
              {
                "type": "SCENE_NODE",
                "name": "主动退出",
                "clazz": "SceneLibManualExitNode",
                "component": "SceneLibManualExitNode",
                "icon": "manualExitNode",
                "description": "用户主动退出",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True"
                  ],
                  "defaultConfiguration": {
                    "triggerMode": [
                      "click"
                    ],
                    "activeTrigger": "close",
                    "publishEvent": "ProductStoping"
                  }
                }
              },
              {
                "type": "SCENE_NODE",
                "name": "前置条件",
                "clazz": "PreconditionNode",
                "component": "SceneLibFrontConditionNode",
                "icon": "frontConditionNode",
                "description": "描述文案",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": false,
                  "editEnabled": true,
                  "removeEnabled": false,
                  "relationTypes": [
                    "true"
                  ],
                  "defaultConfiguration": {
                    "subSceneLogic": null,
                    "subScenes": null,
                    "continuousJudgment": null,
                    "publishEvent": "ProductReadytoStart",
                    "setPreconditions": false
                  }
                }
              }
            ]
          },
          {
            "name": " ",
            "nodeList": [
              {
                "type": "SCENE_NODE",
                "name": "空白场景",
                "clazz": "SceneTemplateNode",
                "component": "SceneLibSceneNode",
                "icon": "sceneLib",
                "description": "",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True",
                    "False"
                  ],
                  "defaultConfiguration": {
                    "subSceneLogic": null,
                    "subScenes": null,
                    "continuousJudgment": null
                  }
                }
              }
            ]
          },
          {
            "name": "AI场景",
            "nodeList": [
              {
                "type": "SCENE_NODE",
                "name": "温暖模式",
                "clazz": "SceneLibraryNode",
                "component": "SceneLibSceneNode",
                "icon": "sceneLib",
                "description": "温暖模式",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True",
                    "False"
                  ],
                  "defaultConfiguration": {
                    "subSceneLogic": "and",
                    "subScenes": [
                      {
                        "signalLogic": "and",
                        "signals": [
                          {
                            "interfaceBid": "0x9002",
                            "serviceBid": "0x2014",
                            "metaModelId": "0_1084",
                            "signalGroup": "vehicleSignal",
                            "signalName": "get the set temperature / set temperatur return",
                            "signalKey": "Notifier_EnFRSetTemp",
                            "optionalFlag": 0,
                            "operator": "<",
                            "value": "18",
                            "maxValue": "",
                            "openParam": null,
                            "dataType": null
                          },
                          {
                            "interfaceBid": "0x9001",
                            "serviceBid": "0x2012",
                            "metaModelId": "0_1044",
                            "signalGroup": "vehicleSignal",
                            "signalName": "获取后除霜状态",
                            "signalKey": "Notifier_EnRearDefrostStatus",
                            "optionalFlag": 0,
                            "operator": "==",
                            "value": "0x0",
                            "maxValue": null,
                            "openParam": null,
                            "dataType": null
                          }
                        ]
                      }
                    ],
                    "continuousJudgment": null
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "name": "车端服务",
        "icon": "serviceLib",
        "type": "SERVICE_NODE",
        "nodeGroup": [
          {
            "name": "",
            "nodeList": [
              {
                "type": "SERVICE_NODE",
                "name": "空白服务",
                "clazz": "ServiceTemplateNode",
                "component": "ServiceLibServiceNode",
                "icon": "serviceLib",
                "description": "",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "interruptionStrategyType": "skip",
                    "executionOrder": null,
                    "serviceSequence": null
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "name": "交互",
        "icon": "interactiveLib",
        "type": "INTERACTIVE_NODE",
        "nodeGroup": [
          {
            "name": "",
            "nodeList": [
              {
                "type": "INTERACTIVE_NODE",
                "name": "弹窗交互",
                "clazz": "PopupInteractionNode",
                "component": "InteractiveLibDialogNode",
                "icon": "dialogNode",
                "description": "通过弹窗征询用户反馈",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [],
                  "defaultConfiguration": {
                    "serviceName": null,
                    "serviceKey": null,
                    "metaModelId": null,
                    "inputParams": null
                  }
                }
              },
              {
                "type": "INTERACTIVE_NODE",
                "name": "弹窗+语音交互",
                "clazz": "PopupAndVoiceInteractionNode",
                "component": "InteractiveLibDialogVoiceNode",
                "icon": "dialogVoiceNode",
                "description": "结合弹窗与语音询问",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [],
                  "defaultConfiguration": {
                    "serviceName": null,
                    "serviceKey": null,
                    "metaModelId": null,
                    "inputParams": null
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "name": "生态服务",
        "icon": "thirdLib",
        "type": "THIRD_NODE",
        "nodeGroup": [
          {
            "name": "生活服务",
            "nodeList": [
              {
                "type": "THIRD_NODE",
                "name": "天气提醒",
                "clazz": "EcologyServiceNode",
                "component": "ThirdLibThirdNode",
                "icon": "thirdLib",
                "description": null,
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "metaModelId": 3,
                    "serviceName": "天气提醒",
                    "serviceKey": "c",
                    "templateId": null,
                    "inputParams": null
                  }
                }
              },
              {
                "type": "THIRD_NODE",
                "name": "恶劣天气提醒",
                "clazz": "EcologyServiceNode",
                "component": "ThirdLibThirdNode",
                "icon": "thirdLib",
                "description": null,
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "metaModelId": 4,
                    "serviceName": "恶劣天气提醒",
                    "serviceKey": "d",
                    "templateId": null,
                    "inputParams": null
                  }
                }
              }
            ]
          },
          {
            "name": "",
            "nodeList": [
              {
                "type": "THIRD_NODE",
                "name": "多媒体播放-图片",
                "clazz": "EcologyServiceNode",
                "component": "ThirdLibThirdNode",
                "icon": "thirdLib",
                "description": null,
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "metaModelId": 100020,
                    "serviceName": "多媒体播放-图片",
                    "serviceKey": "mediaPic",
                    "templateId": null,
                    "inputParams": null
                  }
                }
              },
              {
                "type": "THIRD_NODE",
                "name": "多媒体播放-视频",
                "clazz": "EcologyServiceNode",
                "component": "ThirdLibThirdNode",
                "icon": "thirdLib",
                "description": null,
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "metaModelId": 1000200,
                    "serviceName": "多媒体播放-视频",
                    "serviceKey": "mediaVideo",
                    "templateId": null,
                    "inputParams": null
                  }
                }
              },
              {
                "type": "THIRD_NODE",
                "name": "音乐推荐",
                "clazz": "EcologyServiceNode",
                "component": "ThirdLibThirdNode",
                "icon": "thirdLib",
                "description": null,
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "metaModelId": 100021,
                    "serviceName": "音乐推荐",
                    "serviceKey": "music",
                    "templateId": null,
                    "inputParams": null
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "name": "高级",
        "icon": "advancedLib",
        "type": "ADVANCED_NODE",
        "nodeGroup": [
          {
            "name": "",
            "nodeList": [
              {
                "type": "ADVANCED_NODE",
                "name": "状态变化",
                "clazz": "StateChangeNode",
                "component": "AdvancedLibStateChangeNode",
                "icon": "stateChangeNode",
                "description": "判断信号跳变情况",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True"
                  ],
                  "defaultConfiguration": {
                    "signals": null
                  }
                }
              },
              {
                "type": "ADVANCED_NODE",
                "name": "服务恢复",
                "clazz": "ServiceRecoverNode",
                "component": "AdvancedLibServeBackNode",
                "icon": "serveBackNode",
                "description": "恢复具体服务状态",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success",
                    "Failure"
                  ],
                  "defaultConfiguration": {
                    "serviceList": null
                  }
                }
              },
              {
                "type": "ADVANCED_NODE",
                "name": "频率限制",
                "clazz": "FrequencyLimitNode",
                "component": "AdvancedLibFrequencyNode",
                "icon": "frequencyNode",
                "description": "执行频率限制",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success"
                  ],
                  "defaultConfiguration": {
                    "executeStrategy": "",
                    "executeStrategyTimes": null,
                    "executeStrategyType": null,
                    "limitUnit": null,
                    "limitTime": null,
                    "timeList": null
                  }
                }
              },
              {
                "type": "ADVANCED_NODE",
                "name": "延时节点",
                "clazz": "DelayNode",
                "component": "AdvancedLibDelayNode",
                "icon": "delayNode",
                "description": "暂停等待指定时间",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success"
                  ],
                  "defaultConfiguration": {
                    "delayTime": null,
                    "timeUnit": null
                  }
                }
              },
              {
                "type": "ADVANCED_NODE",
                "name": "时间日期判断",
                "clazz": "TimeJudgementNode",
                "component": "AdvancedLibTimeNode",
                "icon": "timeNode",
                "description": "判断时间",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True",
                    "False"
                  ],
                  "defaultConfiguration": null
                }
              },
              {
                "type": "ADVANCED_NODE",
                "name": "历史触发判断",
                "clazz": "HistoricalJudgementNode",
                "component": "AdvancedLibHistoricalNode",
                "icon": "historicalNode",
                "description": "判断产品历史触发状况",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "True",
                    "False"
                  ],
                  "defaultConfiguration": null
                }
              },
              {
                "type": "FLOW_NODE",
                "name": "并行节点",
                "clazz": "ParallelGatewayStartNode",
                "component": "AdvancedLibParallelStartNode",
                "icon": "parallelStartNode",
                "description": "产品分支并行同时执行",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": true,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [],
                  "defaultConfiguration": {
                    "order": null
                  }
                }
              },
              {
                "type": "FLOW_NODE",
                "name": "并行结束",
                "clazz": "ParallelGatewayEndNode",
                "component": "AdvancedLibParallelEndNode",
                "icon": "parallelEndNode",
                "description": "并行结束节点",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": true,
                  "visible": false,
                  "editEnabled": true,
                  "removeEnabled": true,
                  "relationTypes": [
                    "Success"
                  ],
                  "defaultConfiguration": {
                    "order": 0,
                    "total": 0,
                    "count": 0
                  }
                }
              },
              {
                "type": "FLOW_NODE",
                "name": "结束节点",
                "clazz": "AdvancedLibEndNode",
                "component": "AdvancedLibEndNode",
                "icon": "endNode",
                "description": "强制结束产品运行",
                "configurationDescriptor": {
                  "inEnabled": true,
                  "outEnabled": false,
                  "visible": true,
                  "editEnabled": false,
                  "removeEnabled": true,
                  "relationTypes": [],
                  "defaultConfiguration": {
                    "publishEvent": "ProductStop"
                  }
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

export function getProductInfo(id) {
  return {
    "code": 200,
    "msg": "查询成功",
    "data": {
      "id": "78e9d524-1f1b-ab82-a82e-ce9047828eb4",
      "version": "1.0",
      "productStatus": "0",
      "ruleChainId": "b89cf6ab-da1d-6b5c-668e-0ac3331eaed1",
      "basicId": "8fca413b-8b93-5289-1b35-44740094ec48",
      "validityPeriod": {
        "endTime": "2100-01-01",
        "startTime": "2024-05-09"
      },
      "runMode": null,
      "accessTime": null,
      "durationType": "permanent",
      "oemList": null,
      "defaultOemList": null,
      "productName": "test",
      "productType": "1",
      "remark": "这是一段版本描述",
      "userId": "1",
      "serviceExecuteDesc": "这是一段服务执行描述",
      "triggerDesc": "这是一段触发方式描述",
      "validateResult": 0,
      "displayMethod": "1",
      "voiceCommandStart": "",
      "voiceCommandEnd": "",
      "triggerMethod": "0",
      "optionalSignals": [],
      "ccuIdcVersionList": []
    }
  }
}
export function editProductInfo(data) {
  return request({
    url: '/design/business/ruleChain/editProductVersion',
    method: 'post',
    data
  })
}

export function getSupportVehicles(data) {
  return {
    "code": 200,
    "msg": "查询成功",
    "data": [
      {
        "oem": "广乘广州",
        "oemId": "1",
        "oemCode": "GAC",
        "series": "A08",
        "seriesId": "16",
        "seriesCode": "A08",
        "model": "A08-顶配尊容-1",
        "modelId": "16000",
        "modelCode": "KT1D-0W9-00"
      },
      {
        "oem": "广乘广州",
        "oemId": "1",
        "oemCode": "GAC",
        "series": "A60",
        "seriesId": "60",
        "seriesCode": "A60",
        "model": "A60-次顶配JU2A-0A8-00",
        "modelId": "60006",
        "modelCode": "JU2A-0A8-00"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-中配-孚能+日电产",
        "modelId": "1",
        "modelCode": "G1FA2DA1CN11"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-网约车北方版-孚能+日电产",
        "modelId": "10",
        "modelCode": "G1FA2DA1CN20"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-低配北方版-CATL+日电产",
        "modelId": "11",
        "modelCode": "G1CR2DA1CN22"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-高配-CATL+日电产",
        "modelId": "8",
        "modelCode": "G1CR2DA1CN12"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-网约-南方版-CALB50+日电产",
        "modelId": "92",
        "modelCode": "G1Z12DA1HZ19"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-网约-北方版-CALB50+日电产",
        "modelId": "93",
        "modelCode": "G1Z12DA1HZ20"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A26",
        "seriesId": "1",
        "seriesCode": "A26",
        "model": "A26-中配-CALB50+日电产",
        "modelId": "95",
        "modelCode": "G1Z12DA1HZ11"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A20",
        "seriesId": "11",
        "seriesCode": "A20",
        "model": "2022款  70乐享版",
        "modelId": "11001",
        "modelCode": "GACJ2DA3CN24"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A20",
        "seriesId": "11",
        "seriesCode": "A20",
        "model": "A20_V3_70畅享版2",
        "modelId": "1119",
        "modelCode": "G7CJ2DA2CN24"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A29",
        "seriesId": "18",
        "seriesCode": "A29",
        "model": "网约-58Ah限DOD-HCU4",
        "modelId": "18008",
        "modelCode": "G8ZR2DA4CN20"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A29",
        "seriesId": "18",
        "seriesCode": "A29",
        "model": "80 科技版-60Ah",
        "modelId": "18020",
        "modelCode": "G8F42DA4CN12"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A27",
        "seriesId": "8",
        "seriesCode": "A27",
        "model": "魅580低配-移",
        "modelId": "08001",
        "modelCode": "G5Z82DA2C123"
      },
      {
        "oem": "广新",
        "oemId": "2",
        "oemCode": "GACNE",
        "series": "A02",
        "seriesId": "201",
        "seriesCode": "A02",
        "model": "A02",
        "modelId": "201001",
        "modelCode": "A02"
      },
      {
        "oem": "广乘杭州",
        "oemId": "3",
        "oemCode": "GAH",
        "series": "A11",
        "seriesId": "14",
        "seriesCode": "A11",
        "model": "A11-顶配-DU2D-0A9-01",
        "modelId": "889",
        "modelCode": "DU2D-0A9-01"
      },
      {
        "oem": "广乘广州",
        "oemId": "1",
        "oemCode": "GAC",
        "series": "A55",
        "seriesId": "20",
        "seriesCode": "A55",
        "model": "A55-顶配性能版-BB2A-0W8-04",
        "modelId": "55018",
        "modelCode": "BB2A-0W8-04"
      },
      {
        "oem": "广乘杭州",
        "oemId": "3",
        "oemCode": "GAH",
        "series": "A11",
        "seriesId": "14",
        "seriesCode": "A11",
        "model": "A11-高配-DU2D-0A7-01",
        "modelId": "891",
        "modelCode": "DU2D-0A7-01"
      },
      {
        "oem": "广丰",
        "oemId": "4",
        "oemCode": "GTMC",
        "series": "A27-T",
        "seriesId": "10",
        "seriesCode": "A27-T",
        "model": "A27-T-高配-尊贵版630-黑色内饰",
        "modelId": "03002",
        "modelCode": "T2Z52DA3CN12"
      },
      {
        "oem": "广丰",
        "oemId": "4",
        "oemCode": "GTMC",
        "series": "A27-T",
        "seriesId": "10",
        "seriesCode": "A27-T",
        "model": "A27-T 高配",
        "modelId": "676",
        "modelCode": "T2Z52DA2CN12"
      }
    ]
  }
}

export function sceneNodeCheck(data) {
  return request({
    url: '/design/business/conflict/sceneNodeCheck',
    method: 'post',
    data
  })
}

export function serviceNodeCheck(data) {
  return request({
    url: '/design/business/conflict/serviceNodeCheck',
    method: 'post',
    data
  })
}

export function autoTriggerCheck(data) {
  return request({
    url: '/design/business/conflict/autoTriggerCheck',
    method: 'post',
    data
  })
}

export function voiceCommendCheck(data) {
  return request({
    url: '/design/business/conflict/voiceCommendCheck',
    method: 'post',
    data
  })
}

export function validateRuleChainAvailable(data) {
  return request({
    url: '/design/business/object/checkValid',
    method: 'post',
    data
  })
}

export function downloadRuleChain(params) {
  return request({
    url: `/design/business/v1/product/file/download/productFile/${params}`,
    method: 'get',
    responseType: 'blob'
  })
}

export default {
  getRuleChain,
  saveRuleChainInfo,
  getRuleNodeComponents,
  editProductInfo,
  getProductInfo,
  getSupportVehicles,
  sceneNodeCheck,
  serviceNodeCheck,
  autoTriggerCheck,
  voiceCommendCheck,
  validateRuleChainAvailable,
  downloadRuleChain
}
